package com.zc.common.mq.consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * <p>Description : </p>
 *
 * @author : xuhongcao
 * @version : v1.0.0
 * @since : 6/4/2022
 **/
@Service
public class InitDefaultReceiveTable {

    @Autowired
    private JdbcTemplate jdbcTemplate;


    @PostConstruct
    public void init(){
        String initSendLog = "create table if not exists receive_message_log( id                bigint              not null primary key auto_increment, message_key       VARCHAR(36)         not null, topic             VARCHAR(32)         not null, body              json                not null, created_at        datetime            not null, unique index index_message_key(message_key) );";
        this.jdbcTemplate.execute(initSendLog);
    }
}
